package me.shiqiang.im.microservice;

import me.shiqiang.im.microservice.impl.UserQueryMicroServiceHyStrix;
import me.shiqiang.im.microservice.returnobj.UserInfoReturnObj;
import me.shiqiang.im.microservice.returnobj.UserKeyReturnObj;
import me.shiqiang.im.microservice.returnobj.UsersInfoReturnObj;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 用户查询服务feign client
 * Created by John on 17/12/18.
 */
@FeignClient(name = "service-user-query", fallback = UserQueryMicroServiceHyStrix.class)
public interface UserQueryMicroService {

    @RequestMapping(method = RequestMethod.GET, value = "/users-query/uid/{id}")
    UserInfoReturnObj findById(@PathVariable(value = "id") Long id);

    @RequestMapping(method = RequestMethod.POST, value = "/users-query/im-user-info-by-userkey", consumes = "!text/plain")
    UsersInfoReturnObj getUserInfoByUserKeys(@RequestParam("userKeys") String userKeys);

    @RequestMapping(method = RequestMethod.GET, value = "/users-query/userKey-by-id/{uid}")
    UserKeyReturnObj getUserKeyById(@PathVariable("uid") Long uid);


}
